1.redis查看配置
1 2 3 4 5 6 7 8 9 10
| [root@redis ~] 127.0.0.1:6379> CONFIG get * 127.0.0.1:6379> CONFIG get timeout 1) "timeout" 2) "300" 127.0.0.1:6379> CONFIG set timeout 0 OK 127.0.0.1:6379> CONFIG get timeout 1) "timeout" 2) "0"
|
2.redis 通用配置
1 2 3 4 5 6 7 8 9 10 11 12 13
| daemonize no pidfile /path/to/redis.pid bind 192.168.1.2 10.8.4.2 port 6379 unixsocket /tmp/redis.sock unixsocketperm 755 timeout 0 tcp-keepalive 0 loglevel notice logfile “” syslog-ident redis syslog-facility local0 databases 16
|
3.redis 快照配置(rdb持久化)
1 2 3 4 5 6 7 8 9
| save 900 1 save 300 10 save 60 10000 save “” stop-writes-on-bgsave-error yes rdbcompression yes rdbchecksum yes dbfilename dump.rdb dir ./
|
4.redis 安全相关配置
1 2 3
| requirepass yanyi rename-command CONFIG yanyi.config rename-command CONFIG “”
|
5.redis 限制相关配置
1 2 3 4
| maxclients 10000 maxmemory <bytes> maxmemory-policy volatile-lru maxmemory-samples 3
|
6.redis AOF 持久化相关配置
1 2 3 4 5 6
| appendonly no appendfilename “appendonly.aof” appendfsync everysec no-appendfsync-on-rewrite no auto-aof-rewrite-percentage 10 uto-aof-rewrite-min-size 64mb
|
7.redis 慢日志相关配置
针对慢日志,你可以设置两个参数,一个是执行时长,单位是微秒,另一个是慢日志的长度。当一个新的命令被写入日志时,最老的一条会从命令日志队列中被移除。
1 2
| slowlog-log-slower-than 10000 slowlog-max-len 128
|